﻿<?php
require_once 'map_functions.php';
?>

<!-- <embed src="images/society.mp3" autostart="true" loop="false" width="250" height="70" controller="true" ></embed>-->	
	<div class="content centered">
		<div id="distance"></div>				
	<!-- Menu de la izquierda-->
	<div id="menu" class="ui-tabs  menu">	
	
		<ul class="ui-tabs-nav">		  
			<!-- BUSQUEDAS-->		
			<li title="Salidas en Punta Alta" name="Quiero salir a " class="ui-state-default ui-tabs-selected">
				<a class="salidas " href="#salidas">Salidas
					<span class="all" onclick="find_all('salidas')" title="Ver todos los locales">Todos</span>
				</a>
			</li>
			<li title="Calles de Punta Alta" name="Busco la " class="ui-state-default">
			  <a class="calles " href="#calles">Calles</a>
			</li>
			<li title="Plazas, Parques de Punta Alta" name="Quiero ir a " class="ui-state-default">
				<a class="plazas " href="#plazas">Plazas
					<span class="all" onclick="find_all('plazas')" title="Ver todos las Plazas y Parques">Todos</span>
				</a>
			</li>
			<li title="Negocios en Punta Alta" name="Busco el Negocio" class="ui-state-default">
				<a class="negocios " href="#negocios">Negocios
					<span class="all" onclick="find_all('negocios')" title="Ver todas los Negocios">Todos</span>
				</a>
			  </li>
			<li title="Lugares de Interes en Punta Alta" name="Busco" class="ui-state-default">
			  <a class="interes " href="#interes">Interes
				<span class="all" onclick="find_all('interes')" title="Ver todos los Lugares de Interes">Todos</span>
			  </a>
			</li>
			<li title="Deporte en Punta Alta" name="Deportes" class="ui-state-default">
			  <a class="deportes " href="#deporte">Deporte
			  	<span class="all" onclick="find_all('deporte')" title="Ver todos los Lugares de Deporte">Todos</span>
	  		  </a>
			</li>
			<li title="Farmacias en Punta Alta" name="Farmacias" class="ui-state-default">
			  <a class="farmacias " href="#farmacias">Farmacias
			  	<span class="all" onclick="find_all('farmacias')" title="Ver todos las Farmacias">Todos</span>
	  		  </a>
			</li>
		</ul>			
			
		<!--Tabcontents-->
		<!-- SALIDAS -->
		<ul class="ui-tabs-panel searchOpt" id="salidas">
		<?php
		$query = $this->db->query("SELECT *
									FROM marker
									WHERE marker_cat = 1 AND 
										  aproved = 1
									ORDER BY marker.name
								");
		$places = $query->result_array();
		foreach ($places as $k=>$data){
			$clean_name = str_replace('-', ' ', $data['name']);
			echo '<li id="'.$data['name'].'" class="listOpt" value="'.$data['name'].'" title="'.$clean_name.'" onclick="find(\'salidas\',this.id)">'.$clean_name.'</li>';			 
		} 
		?>
		</ul>
		<!-- CALLES -->
		<ul id="calles" class="ui-tabs-panel searchOpt">
			<li id="1-de-Mayo" 	class="listOpt" onclick="find_street(this.id);">1 de Mayo</li>
			<li id="2-de-Abril" 	class="listOpt" onclick="find_street(this.id);">2 de Abril</li>
			<li id="2-de-Mayo" 	class="listOpt" onclick="find_street(this.id);">2 de Mayo</li>
			<li id="2-de-Julio" 	class="listOpt" onclick="find_street(this.id);">2 de Julio</li>
			<li id="3-de-Febrero" 	class="listOpt" onclick="find_street(this.id);">3 de Febrero</li>
			<li id="7-de-Marzo" 	class="listOpt" onclick="find_street(this.id);">7 de Marzo</li>				
			<li id="9-de-Julio" 	class="listOpt" onclick="find_street(this.id);">9 de Julio</li>                
			<li id="11-de-Septiembre" class="listOpt" onclick="find_street(this.id);">11 de Septiembre</li>
			<li id="12-de-Mayo" 	class="listOpt" onclick="find_street(this.id);">12 de Mayo</li>
			<li id="12-de-Octubre" class="listOpt" onclick="find_street(this.id);">12 de Octubre</li>
			<li id="14-de-Abril" 	class="listOpt" onclick="find_street(this.id);">14 de Abril</li>
			<li id="17-de-Agosto" class="listOpt" onclick="find_street(this.id);">17 de Agosto</li>				
			<li id="17-de-Febrero" class="listOpt" onclick="find_street(this.id);">17 de Febrero</li>
			<li id="25-de-Mayo"	class="listOpt" onclick="find_street(this.id);">25 de Mayo</li>
			<li id="Alberdi" 		class="listOpt" onclick="find_street(this.id);">Alberdi</li>
			<li id="Alem" 	class="listOpt" onclick="find_street(this.id);">Alem</li>
			<li id="Alfredo-Leoni" class="listOpt" onclick="find_street(this.id);">Alfredo Leoni</li>
			<li id="Almafuerte" 	class="listOpt" onclick="find_street(this.id);">Almafuerte</li>
			<li id="Alvear" 		class="listOpt" onclick="find_street(this.id);">Alvear</li>
			<li id="America" 		class="listOpt" onclick="find_street(this.id);">America</li>
			<li id="Antartida-Argentina" class="listOpt" onclick="find_street(this.id);">Antartida Argentina</li>
			<li id="Aquilino-del-Alamo" class="listOpt" onclick="find_street(this.id);">Aquilino del Alamo</li>
			<li id="Arguelles" 	class="listOpt" onclick="find_street(this.id);">Arguelles</li>
			<li id="Artigas" 	class="listOpt" onclick="find_street(this.id);">Artigas</li>
			<li id="Av-Cabildo" 	class="listOpt" onclick="find_street(this.id);">Avenida Cabildo</li>
			<li id="Av-Colon" class="listOpt" onclick="find_street(this.id);">Avenida Colon</li>
			<li id="Avellaneda" class="listOpt" onclick="find_street(this.id);">Avellaneda</li>
			<li id="Balcarce" 	class="listOpt" onclick="find_street(this.id);">Balcarce</li>
			<li id="Belgrano" 	class="listOpt" onclick="find_street(this.id);">Belgrano</li>
			<li id="Bernardo-de-Irigoyen" class="listOpt" onclick="find_street(this.id);">Bernardo de Irigoyen</li>
			<li id="Berutti" 	class="listOpt" onclick="find_street(this.id);">Berutti</li>
			<li id="Boulogne-Sur-Mer" class="listOpt" onclick="find_street(this.id);">Boulogne Sur Mer</li>
			<li id="Bramuglia" 	class="listOpt" onclick="find_street(this.id);">Bramuglia</li>
			<li id="Brown" 	class="listOpt" onclick="find_street(this.id);">Brown</li>
			<li id="Buchardo" 	class="listOpt" onclick="find_street(this.id);">Buchardo</li>
			<li id="Buchardo-Bis" class="listOpt" onclick="find_street(this.id);">Buchardo Bis</li>
			<li id="Buenos-Aires" class="listOpt" onclick="find_street(this.id);">Buenos Aires</li>
			<li id="Carlos-Gercke" class="listOpt" onclick="find_street(this.id);">Carlos Gercke</li>
			<li id="Carlos-Crossato" class="listOpt" onclick="find_street(this.id);">Carlos Crossato </li>
			<li id="Caseros" 		class="listOpt" onclick="find_street(this.id);">Caseros</li>
			<li id="Catamarca" 	class="listOpt" onclick="find_street(this.id);">Catamarca</li>
			<li id="Chacabuco" class="listOpt" onclick="find_street(this.id);">Chacabuco</li>
			<li id="Chaco" 	class="listOpt" onclick="find_street(this.id);">Chaco</li>
			<li id="Chubut" 	class="listOpt" onclick="find_street(this.id);">Chubut</li>
			<li id="Ciudad-de-Carmelo" class="listOpt" onclick="find_street(this.id);">Ciudad de Carmelo</li>
			<li id="Constitucion" 	class="listOpt" onclick="find_street(this.id);">Constitucion</li>
			<li id="Cordoba" 	class="listOpt" onclick="find_street(this.id);">Cordoba</li>
			<li id="Corrientes" 	class="listOpt" onclick="find_street(this.id);">Corrientes</li>
			<li id="Curzi" 		class="listOpt" onclick="find_street(this.id);">Curzi</li>
			<li id="Daniel-Miguel" class="listOpt" onclick="find_street(this.id);">Daniel Miguel</li>
			<li id="De-la-Madre" 	class="listOpt" onclick="find_street(this.id);">De la Madre</li>
			<li id="Dorrego" 		class="listOpt" onclick="find_street(this.id);">Dorrego</li>
			<li id="Dr-Agote"		class="listOpt" onclick="find_street(this.id);">Dr Agote</li>
			<li id="Dr-Carlos-Solari" class="listOpt" onclick="find_street(this.id);">Dr Carlos Solari</li>
			<li id="Dufourq" 		class="listOpt" onclick="find_street(this.id);">Dufourq</li>
			<li id="Entre-Rios" 	class="listOpt" onclick="find_street(this.id);">Entre Rios</li>
			<li id="Espania" 		class="listOpt" onclick="find_street(this.id);">Espa&Ntilde;a</li>
			<li id="Espora" 	class="listOpt" onclick="find_street(this.id);">Espora</li>
			<li id="Espora-Bis" 	class="listOpt" onclick="find_street(this.id);">Espora Bis</li>
			<li id="Estomba" 	class="listOpt" onclick="find_street(this.id);">Estomba</li>
			<li id="Estrada" 	class="listOpt" onclick="find_street(this.id);">Estrada</li>
			<li id="Falucho" 		class="listOpt" onclick="find_street(this.id);">Falucho</li>
			<li id="Fermin-Ancal" 	class="listOpt" onclick="find_street(this.id);">Fermin Ancal</li>
			<li id="Florida" 		class="listOpt" onclick="find_street(this.id);">Florida</li>
			<li id="Formosa" 		class="listOpt" onclick="find_street(this.id);">Formosa</li>
			<li id="Fournier" 		class="listOpt" onclick="find_street(this.id);">Fournier</li>
			<li id="General-Paz" 	class="listOpt" onclick="find_street(this.id);">General Paz</li>
			<li id="General-Pico" class="listOpt" onclick="find_street(this.id);">General Pico</li>
			<li id="Gonzalez-Fernandez" class="listOpt" onclick="find_street(this.id);">Gonzalez Fernandez</li>
			<li id="Guarani" 	class="listOpt" onclick="find_street(this.id);">Guarani</li>
			<li id="Guemes" 	class="listOpt" onclick="find_street(this.id);">Guemes</li>
			<li id="Hipolito-Irigoyen" class="listOpt" onclick="find_street(this.id);">Hipolito Irigoyen</li>
			<li id="Humberto" 	class="listOpt" onclick="find_street(this.id);">Humberto</li>
			<li id="Islas-Malvinas" class="listOpt" onclick="find_street(this.id);">Islas Malvinas</li>
			<li id="Islas-Orcadas" class="listOpt" onclick="find_street(this.id);">Islas Orcadas</li>
			<li id="Italia" 	class="listOpt" onclick="find_street(this.id);">Italia</li>
			<li id="Jesus-Maria" class="listOpt" onclick="find_street(this.id);">Jesus Maria</li>
			<li id="Jose-Ingenieros" class="listOpt" onclick="find_street(this.id);">Jose Ingenieros</li>
			<li id="Juan-Aguirre" class="listOpt" onclick="find_street(this.id);">Juan Aguirre</li>
			<li id="Jujuy" 	class="listOpt" onclick="find_street(this.id);">Jujuy</li>
			<li id="La-Pampa" class="listOpt" onclick="find_street(this.id);">La Pampa</li>
			<li id="La-Paz" 	class="listOpt" onclick="find_street(this.id);">La Paz</li>
			<li id="La-Plata" class="listOpt" onclick="find_street(this.id);">La Plata</li>
			<li id="Laprida" 		class="listOpt" onclick="find_street(this.id);">Laprida</li>
			<li id="Libertad" 	class="listOpt" onclick="find_street(this.id);">Libertad</li>
			<li id="Los-Andes" 	class="listOpt" onclick="find_street(this.id);">Los Andes</li>
			<li id="Luiggi" 	class="listOpt" onclick="find_street(this.id);">Luiggi</li>
			<li id="Maipu" 	class="listOpt" onclick="find_street(this.id);">Maipu</li>
			<li id="Mar-del-Plata" class="listOpt" onclick="find_street(this.id);">Mar del Plata</li>
			<li id="Martin-Garcia" class="listOpt" onclick="find_street(this.id);">Martin Garcia</li>
			<li id="Mendizabal" 	class="listOpt" onclick="find_street(this.id);">Mendizabal</li>
			<li id="Mendoza" 		class="listOpt" onclick="find_street(this.id);">Mendoza</li>
			<li id="Mercedes-Linares" class="listOpt" onclick="find_street(this.id);">Mercedes Linares</li>
			<li id="Mitre" 	class="listOpt" onclick="find_street(this.id);">Mitre</li>
			<li id="Murature" class="listOpt" onclick="find_street(this.id);">Murature</li>
			<li id="Neuquen" 	class="listOpt" onclick="find_street(this.id);">Neuquen</li>
			<li id="Paul-Harris" 	class="listOpt" onclick="find_street(this.id);">Paul Harris</li>
			<li id="Pasaje-Gutierrez" class="listOpt" onclick="find_street(this.id);">Pasaje Gutierrez</li>
			<li id="Pasaje-Libertador" class="listOpt" onclick="find_street(this.id);">Pasaje Libertador</li>
			<li id="Pasaje-San-Lorenzo" class="listOpt" onclick="find_street(this.id);">Pasaje San Lorenzo</li>
			<li id="Paso" 		class="listOpt" onclick="find_street(this.id);">Paso</li>
			<li id="Paso-de-los-Libres" class="listOpt" onclick="find_street(this.id);">Paso de los Libres</li>
			<li id="Patagones" 	class="listOpt" onclick="find_street(this.id);">Patagones</li>
			<li id="Pellegrini" class="listOpt" onclick="find_street(this.id);">Pellegrini</li>
			<li id="Posadas" 		class="listOpt" onclick="find_street(this.id);">Posadas</li>
			<li id="Primera-Junta" class="listOpt" onclick="find_street(this.id);">Primera Junta</li>
			<li id="Pringles" 	class="listOpt" onclick="find_street(this.id);">Pringles</li>
			<li id="Puerto-Deseado" class="listOpt" onclick="find_street(this.id);">Puerto Deseado</li>
			<li id="Puerto-Madryn" class="listOpt" onclick="find_street(this.id);">Puerto Madryn</li>
			<li id="Pueyrredon" class="listOpt" onclick="find_street(this.id);">Pueyrredon</li>
			<li id="Quintana" 	class="listOpt" onclick="find_street(this.id);">Quintana</li>
			<li id="Reconquista" 	class="listOpt" onclick="find_street(this.id);">Reconquista</li>
			<li id="Remedios-de-Escalada" class="listOpt" onclick="find_street(this.id);">Remedios de Escalada</li>
			<li id="Republica" 	class="listOpt" onclick="find_street(this.id);">Republica</li>
			<li id="Resistencia" 	class="listOpt" onclick="find_street(this.id);">Resistencia</li>
			<li id="Rigoni" 		class="listOpt" onclick="find_street(this.id);">Rigoni</li>
			<li id="Rio-Bermejo" 	class="listOpt" onclick="find_street(this.id);">Rio Bermejo</li>
			<li id="Rio-Colorado" 	class="listOpt" onclick="find_street(this.id);">Rio Colorado</li>
			<li id="Rio-de-la-Plata" class="listOpt" onclick="find_street(this.id);">Rio de la Plata</li>
			<li id="Rio-Dulce" 	class="listOpt" onclick="find_street(this.id);">Rio Dulce</li>
			<li id="Rio-Gallegos" 	class="listOpt" onclick="find_street(this.id);">Rio Gallegos</li>
			<li id="Rio-Grande" 	class="listOpt" onclick="find_street(this.id);">Rio Grande</li>
			<li id="Rio-Juramento"	class="listOpt" onclick="find_street(this.id);">Rio Juramento</li>
			<li id="Rio-Limay" 	class="listOpt" onclick="find_street(this.id);">Rio Limay</li>
			<li id="Rio-Negro"	class="listOpt" onclick="find_street(this.id);">Rio Negro</li>
			<li id="Rio-Parana"	class="listOpt" onclick="find_street(this.id);">Rio Parana</li>
			<li id="Rio-Pilcomayo" class="listOpt" onclick="find_street(this.id);">Rio Pilcomayo</li>
			<li id="Rio-Uruguay"	class="listOpt" onclick="find_street(this.id);">Rio Uruguay</li>
			<li id="Rivadavia" 	class="listOpt" onclick="find_street(this.id);">Rivadavia</li>
			<li id="Roberto-Patrignani" class="listOpt" onclick="find_street(this.id);">Roberto Patrignani</li>
			<li id="Roca" 		class="listOpt" onclick="find_street(this.id);">Roca</li>
			<li id="Rodriguez-Penia" class="listOpt" onclick="find_street(this.id);">Rodriguez Pe&Ntilde;a</li>
			<li id="Rosales" 		class="listOpt" onclick="find_street(this.id);">Rosales</li>
			<li id="Rosario" 	class="listOpt" onclick="find_street(this.id);">Rosario</li>
			<li id="Saavedra" class="listOpt" onclick="find_street(this.id);">Saavedra</li>
			<li id="Saenz-Penia" class="listOpt" onclick="find_street(this.id);">Saenz Pe&Ntilde;a</li>
			<li id="Salta" 		class="listOpt" onclick="find_street(this.id);">Salta</li>
			<li id="San-Juan" 	class="listOpt" onclick="find_street(this.id);">San Juan</li>
			<li id="San-Luis" 	class="listOpt" onclick="find_street(this.id);">San Luis</li>
			<li id="San-Martin" class="listOpt" onclick="find_street(this.id);">San Martin</li>
			<li id="Santa-Cruz" 	class="listOpt" onclick="find_street(this.id);">Santa Cruz</li>
			<li id="Santa-Fe" 		class="listOpt" onclick="find_street(this.id);">Santa Fe</li>
			<li id="Santiago-del-Estero" class="listOpt" onclick="find_street(this.id);">Santiago del Estero</li>
			<li id="Sargento-Cabral" class="listOpt" onclick="find_street(this.id);">Sargento Cabral</li>
			<li id="Sarmiento" class="listOpt" onclick="find_street(this.id);">Sarmiento</li>
			<li id="Tierra-del-Fuego" class="listOpt" onclick="find_street(this.id);">Tierra del Fuego</li>
			<li id="Tonelli-de-Penia" class="listOpt" onclick="find_street(this.id);">Tonelli de Pe&Ntilde;a</li>
			<li id="Triunvirato" 	class="listOpt" onclick="find_street(this.id);">Triunvirato</li>
			<li id="Tucuman" 	class="listOpt" onclick="find_street(this.id);">Tucuman</li>
			<li id="Uriburia" 	class="listOpt" onclick="find_street(this.id);">Uriburia</li>
			<li id="Uriburu" 		class="listOpt" onclick="find_street(this.id);">Uriburu</li>
			<li id="Urquiza" 	class="listOpt" onclick="find_street(this.id);">Urquiza</li>
			<li id="Ushuaia" 		class="listOpt" onclick="find_street(this.id);">Ushuaia</li>
			<li id="Uspallata" 	class="listOpt" onclick="find_street(this.id);">Uspallata</li>
			<li id="Vazquez" 		class="listOpt" onclick="find_street(this.id);">Vazquez</li>
			<li id="Velez-Sarfield" class="listOpt" onclick="find_street(this.id);">Velez Sarfield</li>
			<li id="Villanueva" 	class="listOpt" onclick="find_street(this.id);">Villanueva</li>
			<li id="Vucetich"		class="listOpt" onclick="find_street(this.id);">Vucetich</li>
			<li id="Wimer" 		class="listOpt" onclick="find_street(this.id);">Wimer</li>
			<li id="Yapeyu" 		class="listOpt" onclick="find_street(this.id);">Yapeyu</li>
		</ul>
		<!-- NEGOCIOS -->
		<ul class="ui-tabs-panel searchOpt" id="negocios">
		<?php

		$query = $this->db->query("SELECT *
									FROM marker
									WHERE marker_cat = 4 AND
										  aproved = 1
									ORDER BY marker.name
								");
		$places = $query->result_array();
		foreach ($places as $k=>$data){					
			$clean_name = str_replace('-', ' ', $data['name']);
			echo '<li id="'.$data['name'].'" class="listOpt" value="'.$data['name'].'" title="'.$clean_name.'" onclick="find(\'negocios\',this.id)">'.$clean_name.'</li>';			 
		} 
		 
		?>
		</ul>		
		<!-- PLAZAS -->
		<ul id="plazas" class="ui-tabs-panel searchOpt">
		<?php
		$query = $this->db->query("SELECT *
									FROM marker
									WHERE marker_cat = 2 AND
										   aproved = 1
									ORDER BY marker.name
								");
		$places = $query->result_array();
		foreach ($places as $k=>$data){
			$clean_name = str_replace('-', ' ', $data['name']);
			echo '<li id="'.$data['name'].'" class="listOpt" value="'.$data['name'].'" title="'.$clean_name.'" onclick="find(\'plazas\',this.id)">'.$clean_name.'</li>';			 
		} 
		?>
		</ul>	
		<!-- SITIOS DE INTERES -->
		<ul class="ui-tabs-panel searchOpt" id="interes">
		<?php
		$query = $this->db->query("SELECT *
									FROM marker
									WHERE marker_cat = 3 AND
										 aproved = 1
									ORDER BY marker.name
								");
		$places = $query->result_array();
		foreach ($places as $k=>$data){					
			$clean_name = str_replace('-', ' ', $data['name']);
			echo '<li id="'.$data['name'].'" class="listOpt" value="'.$data['name'].'" title="'.$clean_name.'" onclick="find(\'interes\',this.id)">'.$clean_name.'</li>';			 
		} 
		?>
		</ul>
		<ul id="deporte" class="ui-tabs-panel searchOpt">
		<?php
		$query = $this->db->query("SELECT *
									FROM marker
									WHERE marker_cat = 5 AND
										 aproved = 1
									ORDER BY marker.name
								");
		$places = $query->result_array();
		foreach ($places as $k=>$data){					
			$clean_name = str_replace('-', ' ', $data['name']);
			echo '<li id="'.$data['name'].'" class="listOpt" value="'.$data['name'].'" title="'.$clean_name.'" onclick="find(\'deporte\',this.id)">'.$clean_name.'</li>';			 
		} 
		?>
		</ul>
		<!-- FARMACIAS-->
		<ul id="farmacias" class="ui-tabs-panel searchOpt">
		<?php
		$query = $this->db->query("SELECT *
									FROM marker
									WHERE marker_cat = 7 AND
										 aproved = 1
									ORDER BY marker.name
								");
		$places = $query->result_array();
		foreach ($places as $k=>$data){			
			$query = $this->db->query("SELECT *
					FROM deturno
					WHERE deturno.farmacia = ".$data['id_marker']." AND
					(NOW() BETWEEN deturno.fecha_inicio AND deturno.fecha_fin)
					");
			$deturno = $query->row_array();
				
			$clean_name = str_replace('-', ' ', $data['name']);
			$deturno_atr = (empty($deturno))?"class='listOpt' title='$clean_name'":"class='listOpt deturno' title='HOY De Turno'";
			echo '<li id="'.$data['name'].'" '.$deturno_atr.' value="'.$data['name'].'" onclick="find(\'farmacias\',this.id)">'.$clean_name.'</li>';
		}		
		?>
		</ul>		
					
   </div> 
	<div class='ui-widget-content menu' style="padding: .2em; margin-bottom: 15px;">
   		<!--MAP-->
		<div id="map_container" class="lheader" title="Mapa de Punta Alta">		
			<div id="map" class="light_border"></div>
		</div>
		<!--TWITTER-->
		<ul>
		<li id="noticias" title="Punta Alta, Noticias" class="twitter_feed lheader">
			<h2 class="ui-accordion-header ui-state-default ui-corner-top">Noticias</h2>
			<script>			
			new TWTR.Widget({
			  version: 2,
			  type: 'search',
			  search: 'conocepunta OR from:lanuevaweb OR from:bahiadigital OR from:tn_todonoticias OR from:c5n OR from:elrosalenio OR from:labrujula24 OR from:mendozaopina OR from:LaGacetaTucuman OR from:perfildiario OR from:infobae OR #bahiablanca OR #puntaalta',
			  //search: '#bahiablanca',
			  interval: 15000,
			  title: '',
			  subject: '',
			  width: 'auto',
			  height: '368',
			  theme: {
				shell: {
				  background: 'none',
				  color: '#000000'
				},
				tweets: {
				  background: 'none',
				  color: '#000000',
				  links: '#DC5751'
				}
			  },
			  features: {
				scrollbar: true,
				loop: true,
				live: true,
				hashtags: true,
				timestamp: true,
				avatars: true,
				behavior: 'default'
			  }
			}).render().start();
			</script>
		</li>		
		</ul>
		<!--Gente-->
		<div id="people" class="lheader" title="Gente de Punta Alta">	  
		  <script type="text/javascript" src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/es_LA"></script> 	 
		  <script type="text/javascript">FB.init("edc0e6f739f0be7af057dafadf35bab3");</script>
		  <fb:fan profile_id="145094618228" stream="0" connections="8" logobar="0" width="150" height="445"></fb:fan>
		  <div style="display:none; font-size:8px; padding-left:10px"><a href="http://www.facebook.com/pages/Punta-Alta-Argentina/Conoce-Punta/145094618228">Conoce Punta</a> on Facebook</div>
		</div>	
	</div>   
    <!--fin CONTENT-->
	</div>
	
	<div class="content centered">
     <!-- Eventos-->
    <ul id="events" class="lheader" title="Punta Alta, Eventos">
		<?php
		$query = $this->db->query("
									SELECT 
										e.name,
										e.description,
										e.img,
										e.icon,
										e.fecha,
										m.name as m_name,
										m.lat,
										m.lng,
										m.address,
										m.city,
										m.description as m_description,
										m.img as m_img,
										m.icon as m_icon,
										m.marker_cat as m_cat,
										c.name as c_name
									FROM evento as e
									LEFT OUTER JOIN marker as m ON e.place = m.id_marker
									LEFT OUTER JOIN categoria as c ON m.marker_cat = c.id_categoria
	  	 							ORDER BY e.fecha DESC
	  	 							LIMIT 10
	  	 							");
		 $places = $query->result_array();	 				
		 
		foreach ($places as $k=>$data){
			$places[$k]['icon'] = base_url()."images/icons/".$data['icon'];
			if(strpos($data['img'], ':') === false){
				$data['img'] = $places[$k]['icon'];	//this updates local image url, not the data structure itself
			}			
			$clean_name   = str_replace('-', ' ', $data['name']);
			$clean_m_name = str_replace('-', ' ', $data['m_name']);
			$data['city'] = str_replace(' ', '' , $data['city']);	//to enable TWT hashtag

			$date = date("M D j, G:i",strtotime($data['fecha']))."HS";

			$evt_date = new DateTime($data['fecha']);
			$now 	  = new DateTime("now");						
			$interval = $now->diff($evt_date);
				
			if($interval->invert == 1){
				//ya paso el evento
				echo '<li class="box post option" onclick="find(\'eventos\',\''.$data['name'].'\')" title="Click para verlo en el mapa">'.
						'<div class=" ui-state-default"><a class="url" name="'.$data['name'].'"></a>
							<div class="tape">								
								<span class="date">'.$date.'</span>
							</div>
							<a class="title option" href="'.base_url().$data['c_name'].'/nombre/'.$data['m_name'].'" target="_new">'.$data['city'].', '.$clean_m_name.': '.$clean_name.'.</a>
						</div>
						<div class="brief">
							<figure><img class="lheader post_img" alt="'.str_replace(' ', '', $data['city']).', '.$clean_m_name.': '.$clean_name.'" src="'.$data['img'].'"></figure>
							<div class="wrapper_comment">
								<p class="comment">'.str_pad(substr($data['description'],0,25),28,"...").'</p>
							</div>
						</div>'.
						'</li>';				
			}else{
				//falta para el evento
				echo '<li class="box post option" onclick="find(\'eventos\',\''.$data['name'].'\')" title="Click para verlo en el mapa">'.
						'<div class=" ui-state-default"><a class="url" name="'.$data['name'].'"></a>
							<div class="tape">
								<div class="triangle triangle_left_r"></div>
								<span class="date new">'.$date.'</span>
							</div>
							<h4 class="title">'.$data['city'].', '.$clean_m_name.': '.$clean_name.'.</h4>
						</div>
						<div class="brief">
							<figure><img class="lheader post_img" alt="'.str_replace(' ', '', $data['city']).', '.$clean_m_name.': '.$clean_name.'" src="'.$data['img'].'"></figure>
							<div class="wrapper_comment">
								<p class="comment">'.str_pad(substr($data['description'],0,25),28,"...").'</p>
							</div>
						</div>'.
					  '</li>';				
			}
		} 
		?>
		<li><a class="figcaption" href="http://www.conocepunta.com.ar/eventos/">Eventos anteriores...</a></li>
    </ul>
	<!-- MORE EVENTS -->	
	
	<!-- SIDEBAR-->
	<ul id="sidebar"  class="lheader">				
		<li>
						
			<?php echo form_open(base_url()."contacto/process", 'onsubmit="return false;" id="contact" class="box"'); ?>
			<h2 class="ui-accordion-header ui-state-default">Feedback</h2>
			<div class="comment" style="text-align:center; padding: 0px 0px 20px">
				<p>&iquest;Que pensas del sitio? &iquest;Es util? &iquest;Que podemos mejorar?</p>
				<h4 style='font-weight: normal; font-size: 1.25em;'>Tu opinion es muy importante para nosotros.</h4>			
			</div>
			<div>
				<!-- <label for="username">*Nombre:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label> -->				
				<input class="input" placeholder="*Nombre" type="text" name="username" id="username"/>				
			</div>
			<div>
				<!-- <label for="email">*Email:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>-->				
				<input class="input" placeholder="*Email" type="text" name="email" id="email"/>				
			</div>
			<div>
				<!-- <label for="comment">*Comentario:</label> -->								
				<textarea class="input" placeholder="*Comentario" rows="5" cols="27" name="comment" id="comment"></textarea>				
			</div>
			<div class="comment" style="margin-bottom: 35px;">				
				<!-- <span>*Campos obligatorios</span> -->
				<input class="submit" type="submit" value="Enviar" />				
			</div>
			<span id="success" class="ui-state-highlight" style="display:none"></span>
			</form>
		</li>

		<li class="figcaption">
			<script type="text/javascript"><!--
			google_ad_client = "ca-pub-2113662635661393";
			/* Sidebar */
			google_ad_slot = "5693718012";
			google_ad_width = 336;
			google_ad_height = 280;
			//-->
			</script>
			<script type="text/javascript"
			src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
			</script>		
		</li>

		<!-- ML -->
		<li style="padding-top:5px; padding-left:30px">
			<!-- 
			<iframe src="http://pmssrv.mercadolibre.com.ar/jm/PmsSrv?tool=6126531&creativity=469812&new=Y&ovr=Y" 
			width="300" height="250" scrolling="no" frameborder="0" marginheight="0" marginwidth="0">
			</iframe>
			 -->			
			<iframe src="http://smartad.mercadolibre.com.ar/jm/SmartAd?tool=6130020&creativity=32401&new=Y&ovr=N&bgcol=FFFFFF&brdcol=000000&txtcol=006600&lnkcol=0000FF&hvrcol=FF0000&prccol=FF0000&word=vehiculos&word=ropa&word=juguetes&site=MLA" 
			width="300" height="250" scrolling="no" frameborder="0" marginheight="0" marginwidth="0">
			</iframe>			
		</li>			
		<!-- 
		<li id="noticias" title="Punta Alta, Noticias" class="menu twitter_feed">
			<h2 class="ui-accordion-header ui-state-default ui-corner-top">Noticias al instante</h2>
			<script>			
			new TWTR.Widget({
			  version: 2,
			  type: 'search',
			  search: 'conocepunta OR from:lanuevaweb OR from:bahiadigital OR from:tn_todonoticias OR from:c5n OR from:elrosalenio OR from:labrujula24 OR from:mendozaopina OR from:LaGacetaTucuman OR from:perfildiario OR from:infobae OR #bahiablanca OR #puntaalta',
			  //search: '#bahiablanca',
			  interval: 15000,
			  title: '',
			  subject: '',
			  width: 'auto',
			  height: '500',
			  theme: {
				shell: {
				  background: 'none',
				  color: '#000000'
				},
				tweets: {
				  background: 'none',
				  color: '#000000',
				  links: '#DC5751'
				}
			  },
			  features: {
				scrollbar: true,
				loop: true,
				live: true,
				hashtags: true,
				timestamp: true,
				avatars: true,
				behavior: 'default'
			  }
			}).render().start();
			</script>
		</li>
		-->
	</ul>
	</div>
	
	<div id="error">		
		<div class="ui-dialog-content">			
			<div id="error_message">
				<div id="personal_message"></div>
			</div>
			<a title="Ayudanos en Twitter" class="option twitter icon rheader" href="http://www.twitter.com/conocepunta" target="_new"></a>
			<a class="option rheader">|</a>
			<a title="Ayudanos en Facebook" class="option facebook icon rheader" href="http://www.facebook.com/pages/Conoce-Punta/145094618228" target="_new"></a>
		</div>
	</div>	

<!--<script alt="" src="<?php echo base_url();?>js/lib/jquery/jquery.rating.js" type="text/javascript"></script>-->
<script type="text/javascript">						
	$('.post').each(function(){
		//--------------------------------
		var date  = $(this).find(".date").text();
		var title = $(this).find(".title").text();
		var url   = $(this).find(".url").attr('name');
        //url       = url.replace(/_/g,'-');
				
		var botonera = '<div class="addthis_toolbox">'+				
							'<div class="hover_effect">'+
							'<div class="inline lheader"><a class="addthis_button_twitter"'+
								'addthis:url="<?php echo base_url();?>eventos/nombre/'+url+'"'+
								'addthis:title="'+date+': #'+title+' @conocepunta">&nbsp;Twitter</a></div>'+
							'<div class="inline lheader"><a class="addthis_button_google"'+
								'addthis:url="<?php echo base_url();?>eventos/nombre/'+url+'"'+
								'addthis:title="'+date+': '+title+' @conocepunta">&nbsp;Google</a></div>'+								
							'<div class="inline lheader"><a class="addthis_button_expanded">&nbsp;&nbsp;Mas</a></div>'+
							'<div style="clear:both; float:none;"></div>'+
						    '</div>'+				
						'</div>';
			
		$(botonera).insertAfter($(this).find('.brief > .wrapper_comment'));
	
		var more = '<a href="<?php echo base_url();?>eventos/nombre/'+url+'" target="_new">Mas informacion...</a>';		
		$(more).insertAfter($(this).find('.brief > .wrapper_comment'));						
							
		var face_like = '<span class="fb_like"><iframe src="http://www.facebook.com/plugins/like.php?href=www.conocepunta.com.ar/eventos/nombre/'+url+'&amp;layout=button_count&amp;show-faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;locale=es_LA" frameborder="0" scrolling="no" style="vertical-align: middle; border: medium none; overflow: hidden; width: 100px; height: 21px;" allowtransparency="true"></iframe></span>';	
		$(face_like).insertAfter($(this).find('.date'));			
	});
	
</script>